<template>
  <div>
    <div class="w">
      <div class="content">
        <div class="title">
          <i class="el-icon-s-promotion"></i>
          关于我们
        </div>
        <ul class="detail" v-if="dateilList.length !== 0">
          <li v-for="(item, index) in dateilList" :key="index">
            <div class="imageShow" >
              <h3>{{ item.title }}</h3>
              <div class="img" v-if="item.image">
                <div class="bigImg">
                  <img :src="item.image" alt="" />
                </div>
                <div class="smallImg">
                  <img
                    v-for="(imgSrc, imgindex) in item.photos"
                    :key="imgindex"
                    :src="imgSrc"
                    alt=""
                  />
                </div>
              </div>
            </div>
            <div class="introduction" v-html="item.content"></div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { getDetailById, getAbout } from "@/api";
export default {
  data() {
    return {
      dateilList: [],
    };
  },
  async created() {
    if (this.$route.query.id) {
      const { data } = await getDetailById(this.$route.query.id);
         console.log(data);
      this.dateilList = [data];
    } else {
      const { data } = await getAbout();
      // console.log(res);
      console.log(data);
      this.dateilList = data;
    }
  },
};
</script>

.<style lang="less" scoped>
.content {
  .title {
    height: 50px;
    line-height: 50px;
    color: #ffa500;
    font-size: 20px;
  }
  .detail {
    
    li{
        margin-bottom: 30px;
        border: 1px solid #ccc;
    }
  }
  .imageShow {
    // height: 420px;
    border-bottom: 1px solid #ccc;
    padding: 10px;
    h3 {
      font-size: 30px;
      font-weight: 700;
      line-height: 1.5;
    }
    .img {
      display: flex;
      height: 350px;
      .bigImg {
        flex: 1;
        height: 350px;
        img {
          width: 100%;
          height: 350px;
          object-fit: cover;
        }
      }
      .smallImg {
        flex: 1;
        //  display: flex;
        //  flex-wrap: wrap;
        //  justify-content: space-around;
        img {
          width: 100px;
          height: 100px;
          object-fit: cover;
          margin: 0 10px;
        }
      }
    }
  }
  .introduction {
    padding: 20px 10px;
  }
}
</style>